/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sheep.JUNG.utils;

import edu.uci.ics.jung.graph.Vertex;
import edu.uci.ics.jung.visualization.GraphMouseListener;
import java.awt.event.MouseEvent;
import sheep.controller.Workspace;
import sheep.model.graph.OurVertex;

/**
 *
 * @author geek
 */
public class OurGrapheMouseListener implements GraphMouseListener{

  private Workspace workSpace;
          
  public OurGrapheMouseListener( Workspace workSpace){
    this.workSpace =workSpace;
  } 
  @Override
  public void graphClicked(Vertex vertex, MouseEvent arg1) {
    if (vertex instanceof OurVertex){
      if (workSpace.getCurrentTask()!=null){

        if(workSpace.getCurrentTask().getGraph()!=null){
	workSpace.setSelectedTask(workSpace.getCurrentTask().getGraph().getTask(((OurVertex)vertex)));
        }
      }
    }
  }

  @Override
  public void graphPressed(Vertex arg0, MouseEvent arg1) {
  }

  @Override
  public void graphReleased(Vertex arg0, MouseEvent arg1) {
  }

  
  
  
}
